package net.lcheng.service.impl;

import net.lcheng.dao.UserAgentMapper;
import net.lcheng.model.UserAgent;
import net.lcheng.model.UserAgentExample;
import net.lcheng.service.UserAgentService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * Created by zwr on 2016/7/11 0011.
 */
@Service
public class UserAgentServiceImpl implements UserAgentService {
@Resource
private UserAgentMapper userAgentMapper;
    @Override
    public int insert(UserAgent userAgent) {
        return userAgentMapper.insert(userAgent);
    }

    @Override
    public UserAgent getUserAgentByUserId(String userId) {
        UserAgentExample example=new UserAgentExample();
        example.or().andUserUserIdEqualTo(userId);
        List<UserAgent> list=userAgentMapper.selectByExample(example);
        if (list!=null&&list.size()>0){
            return list.get(0);
        }else
            return null;
    }
}
